﻿<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Default Editor</title>

    <link rel="stylesheet" type="text/css" href="http://localhost:8080/testA/arcgisjs/js/dojo/dijit/themes/claro/claro.css" />
    <script type="text/javascript" src="http://localhost:8080/testA/arcgisjs/init.js"></script>
    <script type="text/javascript" src="arcgisjs/jsapi_vsdoc12_v38.js"></script>
    <link rel="stylesheet" type="text/css" href="http://localhost:8080/testA/arcgisjs/js/esri/css/esri.css" />
    <style>
      html, body {
        height: 100%;
        width: 100%;
        margin: 0;
      }

      body {
        background-color: #fff;
        overflow: hidden;
        font-family: Helvetica, san-serif;
      }

      #templatePickerPane {
        width: 225px;
        overflow: hidden;
      }

      #panelHeader {
        background-color: #92A661;
        border-bottom: solid 1px #92A860;
        color: #FFF;
        font-size: 18px;
        height: 24px;
        line-height: 22px;
        margin: 0; 
        overflow: hidden;
        padding: 10px 10px 10px 10px;
      }

      #map {
        margin-right: 5px;
        padding: 0;
      }

      .esriEditor .templatePicker {
        padding-bottom: 5px;
        padding-top: 5px;
        height: 500px;
        border-radius: 0px 0px 4px 4px;
        border: solid 1px #92A661;
      }

      .dj_ie .infowindow .window .top .right .user .content, .dj_ie .simpleInfoWindow .content {
        position: relative;
      }
    </style>

    <script>
        var map;

        require([
          "esri/config",
          "esri/map",
          "esri/SnappingManager",
          "esri/dijit/editing/Editor",
          "esri/layers/FeatureLayer",
          "esri/tasks/GeometryService",
          "esri/toolbars/draw",
          "dojo/keys",
          "dojo/parser",
          "dojo/_base/array",
          "dojo/i18n!esri/nls/jsapi",
          "dijit/layout/BorderContainer",
          "dijit/layout/ContentPane",
          "dojo/domReady!"
        ], function (
          esriConfig, Map, SnappingManager, Editor, FeatureLayer, GeometryService,
          Draw, keys, parser, arrayUtils, i18n
          ) {

            parser.parse();

            //改变提示信息
            i18n.toolbars.draw.start += "<br/>Press <b>CTRL</b> to enable snapping";
            i18n.toolbars.draw.addPoint += "<br/>Press <b>CTRL</b> to enable snapping";

             //代理路径
            esriConfig.defaults.io.proxyUrl = "/proxy/";

            //集合服务
            esriConfig.defaults.geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

            map = new Map("map", {
                basemap: "topo",
                center: [-77.036, 38.891],
                zoom: 16
            });

            map.on("layers-add-result", initEditing);

            var operationsPointLayer = new FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/HSEC/FeatureServer/0", {
                mode: FeatureLayer.MODE_ONDEMAND,
                outFields: ["*"]
            });
            var operationsLineLayer = new FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/HSEC/FeatureServer/1", {
                mode: FeatureLayer.MODE_ONDEMAND,
                outFields: ["*"]
            });
            var operationsPolygonLayer = new FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/HSEC/FeatureServer/2", {
                mode: FeatureLayer.MODE_ONDEMAND,
                outFields: ["*"]
            });

            map.addLayers([
              operationsPointLayer, operationsPolygonLayer, operationsLineLayer
            ]);
            map.infoWindow.resize(400, 300);

            function initEditing(event) {
                var featureLayerInfos = arrayUtils.map(event.layers, function (layer) {
                    return {
                        "featureLayer": layer.layer
                    };
                });

                var settings = {
                    map: map,
                    layerInfos: featureLayerInfos
                };
                var params = {
                    settings: settings
                };
                var editorWidget = new Editor(params, 'editorDiv');
                editorWidget.startup();

               
            }
        });
    </script>
  </head>
  
  <body class="claro">
    <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width:100%; height:100%;">
      <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
      </div>
      <div data-dojo-type="dijit/layout/ContentPane" id="templatePickerPane" data-dojo-props="region:'left'">
        <div id="panelHeader">
          Default Editor
        </div>
        <div style="padding:10px;" id="editorDiv">
        </div>
      </div>
    </div>
  </body>

</html>